package com.changgou;

import org.springframework.security.crypto.bcrypt.BCrypt;

public class test {
    public static void main(String[] args) {
        //循环遍历,每次生成的盐都不一样
        for (int i = 0; i < 5; i++) {
            //获取盐
            String gensalt = BCrypt.gensalt();
            System.out.println("盐:" + gensalt);
            //生成加密密码   密码+盐
            String password = BCrypt.hashpw("123", gensalt);
            System.out.println("加密密码:"+password);
            //校验密码一致性
            boolean flag = BCrypt.checkpw("224", password);
            System.out.println("是否一致性:" + flag);

        }
    }
}
